﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace Touchscreen
{
    public partial class Movie : System.Web.UI.UserControl
    {
        private Voorstelling v;

        protected void Page_Load(object sender, EventArgs e)
        {

        }

        public Voorstelling voorstelling { get { return this.v; } 
            set 
            { 
                v = value;

                labelTitle.Text = v.film_naam;
                labelTime.Text += Convert.ToString(v.datumtijd.ToShortTimeString());
                labelRoom.Text += Convert.ToString(v.zaal_nummer);
                imageLanguage.ImageUrl = Module.FLAGS_FOLDER + v.Film.gesprokentaal + ".gif";
                imagePreview.ImageUrl = Module.IMAGE_FOLDER + v.Film.poster;


                //Aanzetten van de juiste kijkwijzer leeftijd afbeelding.
                switch (v.Film.minimaleleeftijd.ToString())
                {
                    case "0":
                        Image image = new Image();
                        image.ImageUrl = Module.IMAGE_FOLDER + "leeftijd_al_klein.png";
                        panelParentGuide.Controls.Add(image);
                        break;
                    case "6":
                        Image image1 = new Image();
                        image1.ImageUrl = Module.IMAGE_FOLDER + "leeftijd_6_klein.png";
                        panelParentGuide.Controls.Add(image1);
                        break;
                    case "9":
                        Image image2 = new Image();
                        image2.ImageUrl = Module.IMAGE_FOLDER + "leeftijd_9_klein.png";
                        panelParentGuide.Controls.Add(image2);
                        break;
                    case "12":
                        Image image3 = new Image();
                        image3.ImageUrl = Module.IMAGE_FOLDER + "leeftijd_12_klein.png";
                        panelParentGuide.Controls.Add(image3);
                        break;
                    case "16":
                        Image image4 = new Image();
                        image4.ImageUrl = Module.IMAGE_FOLDER + "leeftijd_16_klein.png";
                        panelParentGuide.Controls.Add(image4);
                        break;
                }

                if (v.Film.pauze)
                {
                    Image image = new Image();
                    image.CssClass = "imagepadding";
                    image.ImageUrl = Module.IMAGE_FOLDER + "pauze.png";
                    panelParentGuide.Controls.Add(image);
                }

                if (v.Film._3d)
                {
                    Image image = new Image();
                    image.CssClass = "imagepadding";
                    image.ImageUrl = Module.IMAGE_FOLDER + "3d.png";
                    panelParentGuide.Controls.Add(image);
                }
        
        } 
        }

        public Label labelTitle         { get { return this.LabelTitle; } }
        public Label labelTime          { get { return this.LabelTime; } }
        public Label labelRoom          { get { return this.LabelRoom; } }
        public Image imagePreview       { get { return this.ImagePreview; } }
        public Label labelLanguage      { get { return this.LabelLanguage; } }
        public Image imageLanguage      { get { return this.ImageLanguage; } }
        public Panel panelParentGuide             { get { return this.PanelParentGuide; } }

        /** Het onzichtbare plaatje dat over de film komt
         * Wordt gebruikt als zijnde een grote button.
         **/ 
        protected void ImageButtonTransparent_Click(object sender, ImageClickEventArgs e)
        {
            Session["voorstelling"] = this.v;
            Response.Redirect("Stap2.aspx");
        }
    }
}